import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
const index = () => import('../components/index.vue')
const recommend = () => import('../components/recommend.vue')
const hotsong = () => import('../components/hotsong.vue')
const search = () => import('../components/search.vue')
const search_btn = () => import('../components/search_btn.vue')

Vue.use(Router)

export default new Router({
  //哈希模式默认带井号，不想带井号+如下
  mode: 'history',
  routes: [
    {
      path: '/',
      //重定向
      redirect: '/recommend'
    },
    {
      path: '/',
      component: index,
      //子路由
      children: [
        //子路由的path不建议带'/'，带上就要写完整的路由
        {path: 'recommend', component: recommend},
        {path: 'hotsong', component: hotsong},
        {path: 'search', component: search},
        {path: 'search_btn', name: 'search_btn', component: search_btn},
      ]
    }
  ]
})
